/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.mycompany.calculator;

/**
 *
 * @author JSJSYS
 */
public class jiajianchengchu {
    
     private int value;
     
     public void ac(){
        value = 0;
    }
     
     public void add(int number){
        value += number;
    }
     
     public void substract(int number){
         if(value==0){
             value=number;
         }
         else{
             value -= number;
         }
    }
     
     public void multiply(int number){
        value *= number;
    }
     
     public void divide(int number){
    
        try{
            value = value/number;
        }catch(Exception e){
            // TODO
        }
    }
     
     public void multiply(double number){
        value *= number;
    }

    public double getValue() {
        return value;
    }
    
     public static void main(String[] args){
        Calculator calculator = new Calculator();
        Calculator.add(10);
        calculator.substract(1);
        calculator.multiply(2);
        calculator.divide(2);
        System.out.println(calculator.getValue());
        calculator.ac();
        System.out.println(calculator.getValue());
    }
    
}
